//
//  DCAlertManager.m
//  Demo
//
//  Created by zhaolin on 2023/1/3.
//

#import "DCAlertManager.h"
#import "ZJAnimationPopView.h"
#import "DCAlertView.h"

ZJAnimationPopView *popView;

@implementation DCAlertManager

+(DCAlertView *)showAlertWithTitle:(NSString *)title content:(NSString *)content commitTitle:(NSString *)commitTitle complant:(AlertManagerCallBack)complant {
    DCAlertView *view = [[DCAlertView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
    [view configureTitle:title content:content commitTitle:commitTitle];
    view.callback = ^(NSString * _Nonnull result) {
        [self dismiss];
        if (complant) {
            complant(result);
        }
    };
    [self popAlertView:view];
    return view;
}

+ (void) popAlertView:(UIView *)view {
   popView = [[ZJAnimationPopView alloc] initWithCustomView:view popStyle:ZJAnimationPopStyleNO dismissStyle:ZJAnimationDismissStyleNO];
    popView.popBGAlpha = 0.5f;
    // 2.3 显示时是否监听屏幕旋转
    popView.isObserverOrientationChange = YES;
    [popView pop];
}

+ (void) dismiss {
  
    [popView dismiss];
    
}
@end
